import request from '@/utils/request'

// 搜索(点位管理)
export const operatorList = data => request.get('/api/task-service/task/search', {
  params: {
    ...data
  }
})
// 工单状态列表
export const allTaskStatus = () => request.get('/api/task-service/task/allTaskStatus')

// 获取当时工单汇总信息
export const taskReportInfo = params => request.get(`/api/task-service/task/taskReportInfo/${params.start}/${params.end}`)

// 获取所有工单类型
export const getTaskList = params => request.get('/api/task-service/taskType/list', { params })

// 工单搜索
export const taskSearch = params => request.get('/api/task-service/task/search', { params })

// 创建工单
export const createTask = data => request.post('/api/task-service/task/create', data)

// 获取工单详情
export const taskInfo = taskId => request.get(`/api/task-service/task/taskInfo/${taskId}`)

// 获取补货预警值
export const supplyAlertValue = params => request.get('/api/task-service/task/supplyAlertValue', { params })

// 设置自动补货工单阈值
export const autoSupplyConfig = data => request.post('/api/task-service/task/autoSupplyConfig', data)

// 补货详情
export const taskDetails = taskId => request.get(`/api/task-service/taskDetails/${taskId}`)

// 取消工单
export const cancel = data => request.post(`/api/task-service/task/cancel/${data.taskId}`, data)
// 获取售货机补货次数

export const supply = (code, start, end) => request.get(`/api/task-service/task/supplyCount/${code}/${start}/${end}`)
// 获取售货机维修次数
export const repairCount = (code, start, end) => request.get(`/api/task-service/task/supplyCount/${code}/${start}/${end}`)

// 工单状态统计
export const collectReport = (start, end) => request.get(`/api/task-service/task/collectReport/${start}/${end}`)

// 人员排名
export const userWorkTop10 = (start, end, isRepair, regionId) => request.get(`/api/task-service/task/userWorkTop10/${start}/${end}/${isRepair}/${regionId}`)
// 获取售货机货道详情
export const channelList = innerCode => request.get(`/api/vm-service/channel/channelList/${innerCode}`)
